<!DOCTYPE html>
<html>
<head>
	<title>编辑-补充内容</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="yes" name="apple-touch-fullscreen">
	<meta content="telephone=no,email=no" name="format-detection">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/AmazeUI/assets/css/amazeui.min.css">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/common.css?v={$WST_V}">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/orders_management.css?v={$WST_V}">
	 <link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/normalize.css" type="text/css">
	 <link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/edit_container.css" type="text/css">
	 <link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/mobiscroll.custom-2.6.2.min.css" type="text/css">
	  <script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jquery-1.7.2.min.js"></script>
	<include file="./Apps/WebApp/View/default/common_js.html" />
	<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/iscroll-zoom.js"></script>
	<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/hammer.js"></script>
	<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/jquery.photoClip.js"></script>
	<!--<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/order_complains.js?v={$WST_V}"></script>-->

	  <script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.core-2.6.2.js"></script>
	  <script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.android-ics-2.6.2.js"></script>
	   <script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.android-2.6.2.js"></script>
		<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.core-2.6.2-zh.js"></script>
		<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.custom-2.6.2.min.js"></script>
		<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/mobiscroll.ios-2.6.2.js"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/hammer.js"></script>
	  <script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jisuan.js">
	</script>
<style type="text/css">
	.week{
		line-height: normal;
	}
	.edit_data_header{
		margin-top:0;
	}
	.input,.input1{
		position: absolute;
		width:100%;
		height:0.64rem;
		top:0;
		left:0;
		background: transparent;
		z-index: 2;
	}
	.input1{
		left:2.133333rem;
		width:50%;
	}
	#YEAR,#HOUR{
		font-size: 0.4rem;
		color: #272727;
		font-weight: bold;
	}
	.dwb-n{
		display: none;
	}
	.dwbc-p .dwbw{
		width:50%;
	}
	.android-ics .dwv{
		border-bottom:0;
		font-size: 0.48rem;
		color: #5A5A5A;
	}
	.android-ics .dw .dwwol{
		border-top:0;
		border-bottom:0;

	}
	.android-ics.light .dwb{
		color: #29A3DA;
	}
	.edit_top{
		height:100%;

	}
	.add_img{
		height:100%;
		padding-top:0.32rem;
		width:100%;
		padding-bottom: 1.06rem;
	}
	.week{
	left:2.36rem;
	}
	fieldset{
		border:0;
	}
	.am-panel-default{
		border:0;
	}
	.am-with-fixed-header{
		padding-top:0;
	}
	.edit_data_header,
	.edit_data_left,
	.edit_data_right
	{
		height:auto;
	}

	.photo{
		width:100%;
		height:100%;
		position: fixed;
		bottom: 0;
		left:0;
		z-index: 999;
	}
	.photo_container{
		width:200px;
		height:120px;
		background:#fff;
		position: absolute;
		top:50%;
		left:50%;
		margin-left:-100px;
		margin-top:-60px;
		border-radius: 5px;
	}
	.photo_zhao{
		width:100%;
		height:100%;
		background:#9D9D9D;
		opacity: 0.5;
	}
	.photo_top{
		width:100%;
		height:69px;
		border-bottom: 1px solid #ddd;
		color:#9D9D9D;
		line-height: 70px;;
		text-align: center;
	}
	.photo_left{
		width:99px;
		height:50px;
		border-right: 1px solid #ddd;
		line-height: 50px;
		text-align: center;
		color:#9D9D9D;
		float: left;
	}
	.photo_right{
		border-right:0;
	}
	.photo_color{
		color:#0e8ee7;
	}
	.complains-container {
		padding-top: 0.5rem;
	}
	.am-panel-bd {
		padding-top: 0px;
	}
	.complains-annex{
		width:30%;
		height:2.33rem;
		float: left;
		margin-left:5%;
		position: relative;

	}
	.complains-annex:nth-of-type(3n+1){
		margin-left:0;
	}
	.complains-img{
		width: 100%;
		height:100%;
		margin:0;

	}
	.del-cover-icon{
		width:100%;
		height:100%;
		color:#fff;
		background:#000;
		opacity: 0.5;
		position: absolute;
		top:0;
		left:0;
		line-height: 2.33rem;
		text-align: center;
		display: none;
	}
</style>

</head>
<body>
	<div class="container">
		<div class="year">
			<div class="year_time">
				<div class="date">选择日期</div>
				<div class="numb"></div>
				<div class="shuer">
					<div class="shuer_left">取消</div>
					<div class="shuer_right">确定</div>
				</div>
			</div>
		</div>
		<div class="hour_week"></div>
		<div class="edit_initial">
			<div class="edit_top">
				<div class="edit_time">
					<div class="edit_time_header">
						<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/edit_to_add_on_choose_time_icon.png" style="width:0.64rem;height:0.64rem;float:left;"><a>选择时间</a>
					</div>
					<div class="edit_data_header">
						<div class="edit_data_left">
							<div class="input"><input id="YEAR" type="text" name="" style="width:100%;height:100%;font-style:normal;border:0;background: transparent;" value="2017/8/18" readonly></div>
							<!-- <div class="data_time">2017/8/18</div> -->
							<div class="week">星期五</div>
							<div class="down_left">
								<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/edit_to_add_on_choose_time_down_more.png" style="width:0.426667rem;height:0.426667rem;padding-top:0.0112rem;margin-left:1.433333rem;">
							</div>
						</div>
						<div class="edit_data_right">
							<div class="input1"><input id="HOUR" type="text" name="" style="width:100%;height:100%;font-style:normal;border:0;background:transparent" value="15:00" readonly></div>
							<div class="down_right">
								<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/edit_to_add_on_choose_time_down_more.png" style="width:0.426667rem;height:0.426667rem;padding-top:0.0112rem;margin-left:0.133333rem;">
							</div>
						</div>
					</div>

				</div>
				<textarea class="text-container" id="content" placeholder="有什么话要说"></textarea>
				<div class="add_img">
					<div class="small"><i style=" font-style:normal">0</i>/3000</div>
					<div class="add">
						<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/edit_to_add_on_add_pictures_icon.png" style="width:0.64rem;height:0.613333rem;float:left;"><i style="display:inline-block;float:left;font-family: PingFangSC-Medium;font-size: 0.32rem;color: #646464;font-style:normal;line-height:0.613333rem;padding-left:0.017067rem;">添加图片</i>
					</div>
					<div class="text">(每条圈最多9张图片，图片大小约640*640，印刷效果会更好)</div>
					<!--<header data-am-widget="header" class="am-header am-header-default am-header-fixed wst-inner-page-nav" id="clip" style="opacity: 0;display:none;">-->
					<!--<div class="am-header-left am-header-nav" onclick="closeUploadArea();">关闭</div>-->
					<!--<div class="am-header-right am-header-nav" id="clipBtn">上传</div>-->
					<!--</header>-->
					<div class="complains-container">
						<section class="am-panel am-panel-default">
							<div class="am-panel-bd" style="padding-left:0;padding-right:0;">
								<form class="am-form">
									<fieldset>
										<div class="am-form-group am-form-file" style="width:100%;">
											<div class="up_img" id="test">
												<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/edit_to_add_on_add_pictures_btn.png" style="width:2.4rem;height:2.4rem;">
											</div>
											<div id="complainsImg" class="complains-img-area"></div>
											<div style="clear:both;"></div>
										</div>
									</fieldset>
								</form>
							</div>
						</section>
					</div>

					<div class="upload-modal" id="upload_modal" style="opacity: 0;display: none">
						<header data-am-widget="header" class="am-header am-header-default am-header-fixed wst-inner-page-nav" id="clip" style="display:none;">
							<!--<div class="am-header-left am-header-nav" onclick="closeUploadArea();">关闭</div>-->
							<!--<div class="am-header-right am-header-nav" id="clipBtn">上传</div>-->
						</header>
						<div class="am-form-group am-form-file">
							<button type="button" class="am-btn am-btn-danger am-btn-sm addImg" id="addImg"><i class="am-icon-cloud-upload"></i></button>


							<div style="clear:both;"></div>
						</div>

						<div class="upload-modal" id="upload_modal">
							<div id="clipArea" class="clipArea"></div>
							<input type="hidden" id="imgData" autocomplete="off">
						</div>

						<div class="am-modal am-modal-loading am-modal-no-btn none" tabindex="-1" id="wst-default-loading">
							<div class="am-modal-dialog">
								<div class="am-modal-hd">Loading...</div>
								<div class="am-modal-bd">
									<span class="am-icon-spinner am-icon-spin"></span>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<div class="regain_bot">
	<div class="regain_center">
		<div class="regain_left">
			<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/regain_back.png" style="width:100%;height:100%;">
		</div>
		<div class="regain_right">
			<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/regain_yes.png" style="width:100%;height:100%;">
		</div>
	</div>
</div>

</body>

<script>
	var WST = ThinkPHP = window.Think = {
		"ROOT"   : "__ROOT__",
		"APP"    : "__APP__",
		"PUBLIC" : "__PUBLIC__",
		"DEEP"   : "{:C('URL_PATHINFO_DEPR')}",
		"MODEL"  : ["{:C('URL_MODEL')}", "{:C('URL_CASE_INSENSITIVE')}", "{:C('URL_HTML_SUFFIX')}"],
		"VAR"    : ["{:C('VAR_MODULE')}", "{:C('VAR_CONTROLLER')}", "{:C('VAR_ACTION')}"],
		"DEFAULT_IMG": "{:WSTDomain()}/{$CONF['goodsImg']}",
	}
	//删除上传的附件
	function delImg(obj){
		$(obj).parent('div.complains-annex').remove();
	}

</script>

<script type="text/javascript">
	$(function () {
    var currYear = (new Date()).getFullYear();
    var opt={};
    opt.date = {preset : 'date'};
    opt.datetime = {preset : 'datetime'};
    opt.time = {preset : 'time'};
    opt.default = {
        theme: 'android-ics light', //皮肤样式
        display: 'modal', //显示方式
        mode: 'scroller', //日期选择模式
        dateFormat: 'yyyy/mm/dd',
        lang: 'zh',
        showNow: true,
        dateOrder: 'yymmdd', //面板中日期排列格式
        dayText: '日',
        monthText: '月',
        yearText: '年', //面板中年月日文字
        headerText:'选择日期',
       	setText: '确定', //确认按钮名称
   		cancelText: '取消',//取消按钮名籍我
        startYear: currYear - 30, //开始年份
        endYear: currYear + 10 //结束年份
    };
    $("#YEAR").mobiscroll($.extend(opt['date'], opt['default']));
});
		$(function () {
    var currYear = (new Date()).getFullYear();
    var opt={};
    opt.date = {preset : 'date'};
    opt.datetime = {preset : 'datetime'};
    opt.time = {preset : 'time'};
    opt.default = {
        theme: 'android-ics light', //皮肤样式
        display: 'modal', //显示方式
        mode: 'scroller', //日期选择模式
        lang: 'zh',
        showNow: true,
        onBeforeShow: function (inst) { inst.settings.wheels[0].length>2?inst.settings.wheels[0].pop():null; },
        timeWheels: 'HHii',
        timeFormat: 'HH:ii',
        hourText: '时',
        minuteText: '分',
        headerText:'选择时间',
       	setText: '确定', //确认按钮名称
   		cancelText: '取消',//取消按钮名籍我
        // startYear: currYear - 50, //开始年份
        // endYear: currYear + 10 //结束年份
    };
    $("#HOUR").mobiscroll($.extend(opt['time'], opt['default']));
});
	 </script>
	 <script type="text/javascript">
	  var textLength =$('.text-container').val().length;
	 $('.small i').text(textLength);
	 $('.text-container').keyup(function(){

	 var textLength =$('.text-container').val().length;
	 $('.small i').text(textLength);
	 })

	 </script>

<script>
	var date = new Date();
	var d = date.getFullYear()+'/'+( date.getMonth()+1 )+'/'+date.getDate();
	var w = date.getDay();
	var ms = date.getHours()+':'+date.getMinutes();
	switch(w){
	  case 1:w = "星期一";break;
	  case 2:w = "星期二";break;
	  case 3:w = "星期三";break;
	  case 4:w = "星期四";break;
	  case 5:w = "星期五";break;
	  case 6:w = "星期六";break;
	  case 0:w = "星期天";break;
	}
	window.ymd=d;
	window.hi=ms;
	window.week=d;
	window.time="";
	window.image="";
	//进页面时换到当前时间
	$("#YEAR").val(d);
	$(".week").text(w);
	$("#HOUR").val(ms);
	//改变日期
	$("#YEAR").change(function(){
		var year=document.getElementById("YEAR").value;
		ymd=year;
//		alert(year);
		$.ajax({
			type: "get",//数据发送的方式（post 或者 get）
			url: " {:U('WxBooks/changdate')}",//要发送的后台地址
			data:{'year':year},//要发送的数据（参数）格式为{'val1':"1","val2":"2"}
			dataType: "json",//后台处理后返回的数据格式
			success:function(data){
				week=(JSON.stringify(data));
				week=week.replace(/\"/g, "");
				$(".week").text(week)
//				window.location.reload()
			}
		})
	});
	$("#HOUR").change(function(){
		hi=document.getElementById("HOUR").value;
	});


	console.log(d);
	console.log(w);
	console.log(ms);

//返回键
	$(".regain_left").click(function(){
		window.history.back(-1);
	})

	$(".regain_right").click(function(){
		var content= $("#content").val();

		$(".imgSrc").each(function(){
			var img
			srcurl= $(this).val();
			img=image;
			img+=srcurl+','
			image=img;

		})
		if(image){
			image=image.substring(0,image.length-1)
		}else{
			image="";
		}

		time+=ymd+' '+hi;

		$.ajax({
			type: "get",//数据发送的方式（post 或者 get）
			url: " {:U('WxBooks/add')}",//要发送的后台地址
			data:{'time':time,'content':content,'image':image},//要发送的数据（参数）格式为{'val1':"1","val2":"2"}
			dataType: "json",//后台处理后返回的数据格式
			success:function(data){
				time="";
				image=""
//				alert(JSON.stringify(data))

				window.location.href =" {:U('WxBooks/wxbook')}"
			}
		})
	})
</script>
<script src="__PUBLIC__/js/think.js?v={$WST_V}"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/common.js?v={$WST_V}"></script>
<script>
	/*
	 * 注意：
	 * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
	 * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
	 * 3. 常见问题及完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
	 *
	 * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决，如仍未能解决可通过以下渠道反馈：
	 * 邮箱地址：weixin-open@qq.com
	 * 邮件主题：【微信JS-SDK反馈】具体问题
	 * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
	 */
	wx.config({
		debug: false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
	nonceStr: '<?php echo $signPackage["nonceStr"];?>',
			signature: '<?php echo $signPackage["signature"];?>',
			jsApiList: [
		// 所有要调用的 API 都要加到这个列表中
		'chooseImage','previewImage','uploadImage','downloadImage'
	]
	});
	var images = {
		localId: [],
		serverId: [],
		download:[]
	};
	var str='';
	wx.ready(function () {
		$('#test').click(function(){
			var checkFull=$('.imgSrc').length;							
			// 在这里调用 API
			if(checkFull<9){
				wx.chooseImage({
					count: 9-checkFull, // 默认9
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
					success: function (res) {
					//var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
						images.localId = res.localIds;
						var i = 0, length = images.localId.length;
						images.serverId = [];
						function upload() {
							wx.uploadImage({
								localId: images.localId[i],
								success: function(res) {
									i++;
									images.serverId.push(res.serverId);
									//alert(res.serverId);
									//下载
									$.ajax({
										type:"post",
										async:false,
										url:WST.U('WebApp/WxBooks/newUploadBook'),
										data:{'media_id':res.serverId},
										success:function(data){
											var json = WST.toJson(data);
											if(json.code==1){
												var str = '<div class="complains-annex " style="float: left;">';
												str +='<div style="100%;height:100%;" class="dianji">'
												str += '<img class="complains-img" src="'+json.aurl+'">';
												str += '<input type="hidden" class="imgSrc" value="'+json.purl+'">';
												str += '</div>';
												str += '<div class="am-icon-close del-cover-icon" onclick="javascript:delImg(this);">刪除</div>';
												str += '</div>';									
												$('#complainsImg').append(str);
											}else{
												wstMsg('上传失败，请重试');
											}
											$('.dianji').on("click",function(){
												$(this).parent().siblings('div').children('.am-icon-close').hide();
												$(this).siblings().show()
											})
										},
										error:function(res){
											alert(res);
										}

									})
									//$.post(Think.U('WebApp/WxBooks/newUploadBook'), {media_id: res.serverId}, );
									if (i < length) {
										setTimeout(upload(),100);
									}
								},
								fail: function(res) {
										alert(JSON.stringify(res));
								}
							});
						}
						upload();
					}//wx.chooseimage:success
				});//wx.chooseimage
			}
		});
	})
	function showimg(obj){
		var imgArray = [];
		var curImageSrc = $(obj).attr('src');
		if (curImageSrc) {
			$('#previewImage img').each(function(index, el) {
				var itemSrc = $(this).attr('src');
				imgArray.push(itemSrc);
			});
			wx.previewImage({
				current: curImageSrc,
				urls: imgArray
			});
		}
	}
</script>
</html>